# coding=utf-8
import os

file_path = "C:/Desktop/folder/myfile.txt"
print('--0--'+file_path)

pd = os.path.split(os.path.abspath(file_path))
print('--1--')
print(pd)

pd1 = os.path.split(os.path.abspath(file_path))[0]
print('--2--'+pd1)

file_path = os.path.splitext(file_path)[0]
print('--3--'+file_path)

file_name = file_path.split("/")[-1]
print('--4--'+file_name)

basename = os.path.basename(file_path)
print('--5--'+basename)

file_name = os.path.splitext(basename)[0]
print('--6--'+file_name)
